﻿namespace Acl.Messages;

/// <summary>
/// 
/// </summary>
/// <typeparam name="TRequestData"></typeparam>
/// <typeparam name="TResponse"></typeparam>
public abstract class DistributionRequestHandler<TRequestData, TResponse> : IDistributionRequestHandler<TRequestData, TResponse>
{
    /// <summary>
    /// 
    /// </summary>
    public abstract DistributionSubscribeOptions? Options { get; }

    Task<TResponse> IDistributionRequestHandler<TRequestData, TResponse>.Handle(IDistributionRequest<TRequestData> request, CancellationToken? cancellationToken)
    {
        TResponse response = Handle(request);


        return Task.FromResult<TResponse>(response);
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="request"></param>
    /// <returns></returns>
    protected abstract TResponse Handle(IDistributionRequest<TRequestData> request);
}
